package com.steakliu.provider;

import com.steakliu.interfaces.UserServiceInterface;
import com.steakliu.provider.service.UserServiceImpl;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;

import java.io.IOException;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2022-08-28  21:20
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class ProviderApiMethod {

    public static void main(String[] args) throws IOException {
        ServiceConfig<UserServiceInterface> serviceConfig = new ServiceConfig<>();
        serviceConfig.setApplication(new ApplicationConfig("dubbo-provider"));
        serviceConfig.setInterface(UserServiceInterface.class);
        RegistryConfig registryConfig = new RegistryConfig();
        serviceConfig.setRegistry(registryConfig);
        registryConfig.setAddress("zookeeper://101.201.113.230:2181");
        serviceConfig.setRef(new UserServiceImpl());
        serviceConfig.setVersion("1.0.0");
        serviceConfig.setGroup("dubbo");
        serviceConfig.export();
        System.out.println("dubbo service register success");
        System.in.read();
    }
}
